import { h } from 'vue';
import { NTag } from 'naive-ui';
import { BasicColumn } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '岗位编码',
    key: 'post_code',
  },
  {
    title: '岗位名称',
    key: 'post_name',
  },
  {
    title: '排序',
    key: 'order_num',
  },
  {
    title: '状态',
    key: 'is_enable',
    render(row) {
      return h(
        NTag,
        {
          type: row.is_enable ? 'success' : 'error',
        },
        {
          default: () => (row.is_enable ? '启用' : '禁用'),
        },
      );
    },
  },
  {
    title: '创建时间',
    key: 'created_at',
  },
];
